//点击创建工作流按钮
function workflowHtml(lessonId) {
    createWorkflow(lessonId);
}
//保存工作流数据
function createWorkflow(lessonId) {
    let url='/workflow/init/class/'+lessonId;
    layer.open({
        type: 2,
        title: '创建工作流',
        closeBtn: 0, //显示关闭按钮
        shade: [0.3],
        area: ['80%', '99%'],
        //offset: 'rb', //右下角弹出
        // time: 2000, //2秒后自动关闭
        anim: 2,
        content: [url, 'yes'], //iframe的url，no代表不显示滚动条
        end: function () {

        }
    });
}
//保存工作流数据
function openWorkflow(lessonId) {
    let url='/workflow/init/class/'+lessonId;
    layer.open({
        type: 2,
        title: '创建工作流',
        closeBtn: 0, //显示关闭按钮
        shade: [0.3],
        area: ['80%', '99%'],
        //offset: 'rb', //右下角弹出
        // time: 2000, //2秒后自动关闭
        anim: 2,
        content: [url, 'yes'], //iframe的url，no代表不显示滚动条
        end: function () {
            layer.closeAll();
            stuEvaluationTable.reload("stuEvaluation", {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        }
    });
}
//查看工作流
function viewWorkflowHtml(workflowIds,lessonId) {
    let workflowIdArray=workflowIds.split(",");
    if (workflowIdArray.length===1){
        viewWorkflowPage(workflowIdArray[0]);
    }else {
        $("[rel=popover]").popover('destroy');
        let popoverObj=$("#viewWorkflow"+lessonId);
        let dataContent = "";
        for (let i=0;i<workflowIdArray.length;i++){
            dataContent+='<span style="padding-right: 5px;padding-bottom: 5px;display: inline-block;"><button type="button" class="btn btn-default" onclick="viewWorkflowPage('+workflowIdArray[i]+')">工作流'+workflowIdArray[i]+'</button></span>'
        }
        dataContent+="<hr/>"

        //console.info(dataContent);
        popoverObj.popover({
            html : true ,
            title: '<span style="font-weight:bold;">查看工作流</span>',
            content: dataContent,
            placement: 'auto'
        });
        popoverObj.popover("show");

    }

}

//打开查看工作流界面
function viewWorkflowPage(workflowId) {
    let url="/workflow/view/"+workflowId;
    layer.open({
        type: 2,
        title: "工作流查看",
        closeBtn: 1, //显示关闭按钮
        shade: [0],
        area: ['80%', '95%'],
        //offset: 'rb', //右下角弹出
        // time: 2000, //2秒后自动关闭
        anim: 2,
        content: [url, 'yes'], //iframe的url，no代表不显示滚动条
        end: function () {
            location.reload(true);
        }
    });
}